<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" style="overflow: hidden">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>评估人员管理</title>
<link rel="shortcut icon" href="${res}favicon.ico" type="image/x-icon" />
 <!--Basic Styles-->
<link href="${ctx}framework/css/font.css" rel="stylesheet" />
<link href="${ctx}framework/miniui/themes/material/miniui.css" rel="stylesheet" />
<link href="${ctx}framework/css/app.min.1.css" rel="stylesheet" type="text/css" />
<link href="${ctx}framework/css/app.min.2.css" rel="stylesheet" type="text/css" />
<script src="${ctx}framework/main.js" type="text/javascript"></script>
<style type="text/css">
    html, body{
        margin:0;padding:0;border:0;width:100%;height:100%;overflow:hidden;
    }    
    </style>
</head>
<body class="body-detail">
	<script>
		Page.onLoad(function(){
			mini.get('dg1').load();	
		});
		
		function add() {
			mini.open({
				width: 650,
				height : 600,
				title : "添加评估人员",
				url : "${ctx}mhr/evaluatorDialog.jhtml",
				onOk : addSave
			});
		}
		
		function addSave() {
			var form = $DW.mini.getForm('form2');
			form.validate();
			if(form.isValid() == false){
				return;
			}
			Server.sendRequest("Evaluator.add",form.getData(),function(response){
				if(response.Status == 1){
					top.mini.showTips({content:response.Message,state:'success'});
					$D.close();
					mini.get('dg1').reload();
				}else{
					top.mini.warn(response.Message);
				}
			});
		}
		
		function gender(e) {
			if (e.record.Gender == "M") {
				return "男";
			} else if (e.record.Gender == "F") {
				return "女";
			}
		}
		
		function edit(member){
			var diag = mini.open({
				width: 650,
				height : 600,
				title : "修改",
				url : "${ctx}mhr/evaluatorEditDialog.jhtml?MemberId="+member,
				onOk : editSave
			});
		}
		
		function editSave() {
			var form = $DW.mini.getForm('form2');
			form.validate();
			if(form.isValid() == false){
				return;
			}
			Server.sendRequest("Evaluator.save",form.getData(),function(response){
				if(response.Status == 1){
					top.mini.showTips({content:response.Message,state:'success'});
					$D.close();
					mini.get('dg1').reload();
				}else{
					top.mini.warn(response.Message);
				}
			});
		}
		
		function addFromUser() {
			mini.open({
				width: 650,
				height : 600,
				title : "添加评估人员",
				url : "${ctx}mhr/evaluatorAddDialog.jhtml",
				onOk : editSave
			});
		}
		
		
		function action(e) {
			var record = e.record
			e.cellStyle = "text-align:center";
	        return '<a href="javascript:edit(\'' + record.Member + '\')">编辑</a>';
		}
		
		function doSearch(){
			mini.get('dg1').load({EmployWay:mini.get("EmployWay").getValue(), SearchName:mini.get("SearchName").getValue()});	
		}
		
		function del() {
			var arr = mini.get('dg1').getSelectedValue();
			if(!arr||arr.length==0){
				top.mini.alert("@{Common.PleaseSelectToDeleteRowFirst}");
				return;
			}
			top.mini.confirm("确认要删除该评估人员？",function(action){
				if(action == "ok"){
					Server.sendRequest("Evaluator.del", {IDs:arr.join()},function(response){
						if(response.Status == 1){
							top.mini.showTips({content:response.Message,state:'success'});
							mini.get('dg1').reload();
						}else{
							top.mini.warn(response.Message);
						}
					});
				}
			});
		}
	</script>
	
	<div class="mini-toolbar" style="margin:2px 10px;" id="toolbar1" plain="true">
	     <a id="addBtn" class="mini-button" iconCls="icon-add" onClick="add()" plain="true">添加评估人员</a>
     	 <a id="removeBtn" class="mini-button" iconCls="icon-remove" onClick="del()" plain="true">删除</a>
		 <div class="pull-right">
		 	<label>类型：</label>
		 	<input class="mini-combobox" id="EmployWay" data='[{id:"UnitJudge",text:"本单位评审员"},{id:"External",text:"外聘评审专家"}]'/>
		 	<label>关键词：</label>
			<input class="mini-textbox" id="SearchName" type="text" emptyText="请输入姓名/编号/手机号"/>
		 	<button class="btn btn-default" id="Submitbutton" onClick="doSearch()"><i class="iconfont icon-search"></i></button>
		 </div>
	</div>
	
	<div class="mini-fit" style="padding:0 10px 10px 10px;">
		<div id="dg1" class="mini-datagrid z-depth-1" style="width:100%;height:100%;" method="Evaluator.grid" idField="Member" multiSelect="true">
		    <div property="columns">
		       	<div type="indexcolumn"></div>
		       	<div type="checkcolumn" ></div>   
	            <div field="UserName" width="13%">用户名</div>
	            <div field="RealName" width="12%">真实姓名</div>
	            <div field="Gender" renderer="gender" width="12%">性别</div>
	            <div field="Mobile" width="12%">手机号</div>
	            <div field="JobCall" width="12%">职称</div>
	            <div name="action" width="100" headerAlign="center" renderer="action">操作</div>
		    </div>
		</div>
	</div>
</body>
</html>